﻿// For an introduction to the Page Control template, see the following documentation:
// http://go.microsoft.com/fwlink/?LinkId=232511
(function () {
    "use strict";

    WinJS.UI.Pages.define("/pages/MonthView/MonthView.html", {
        // This function is called whenever a user navigates to this page. It
        // populates the page elements with the app's data.
        ready: function (element, options) {
            initYearMonthList();
            YearList().selectedIndex = tY - 1900;
            MonthList().selectedIndex = tM;
            initMonthTable();
            drawCld(tY, tM);
            bindCellClickEvent();
        },
        unload: function () {
            //CalendarApp.removeAppBars();
        },

        updateLayout: function (element, viewState, lastViewState) {
            /// <param name="element" domElement="true" />

            // TODO: Respond to changes in viewState.
        }
    });
})();

function goToDay(daynumber) {
    currentYear = cld[daynumber - 1].sYear;
    currentMonth = cld[daynumber - 1].sMonth - 1;
    currentDay = daynumber;
    WinJS.Navigation.navigate("/pages/DayView/DayView.html", { "daynumber": daynumber });
}